﻿$(function () {
    menuActive("binding");

    var oWeixinType = $("#oWeixinType").val();
    $("input[type=radio][value=" + oWeixinType + "]").attr("checked", 'checked');
});

$("#bindingForm").submit(function () {
    $(this).ajaxSubmit({
        dataType: "json",
        beforeSubmit: function () {
            layer.load();
            return true;
        },
        success: function (res, status) {
            switch (res.code) {
                case "N200":
                    layer.closeAll('loading');
                    layer.msg(res.msg, { icon: 1 });
                    setTimeout(function () {
                        window.location.href = res.returnurl;
                    }, 2000);
                    break;
                default:
                    layer.closeAll('loading');
                    layer.msg(res.msg, { icon: 2 });
                    break;
            }
        }
    });
    return false;
});